- milestone = local_assigns[:milestone]
- burndown_endpoint = milestone.group_milestone? ? api_v4_groups_milestones_burndown_events_path(id: milestone.group.id, milestone_id: milestone.id) : api_v4_projects_milestones_burndown_events_path(id: milestone.project.id, milestone_id: milestone.timebox_id)

- if can_generate_chart?(milestone)
  - add_page_startup_graphql_call('burndown_chart/burnup', { id: milestone.to_global_id.to_s, isIteration: false, weight: false })
  .burndown-chart.mb-2{ data: { start_date: milestone.start_date.strftime("%Y-%m-%d"),
    due_date: milestone.due_date.strftime("%Y-%m-%d"),
    milestone_id: milestone.to_global_id,
    is_legacy: legacy_milestone?(milestone),
    burndown_events_path: expose_url(burndown_endpoint) } }

- elsif show_burndown_placeholder?(milestone)
  .burndown-hint.content-block.container-fluid
    = sprite_icon('close', size: 16, css_class: 'dismiss-icon')
    .row
      .col-sm-4.col-12.svg-container
        = custom_icon('icon_burndown_chart_splash')
      .col-sm-8.col-12.inner-content
        %h4
          Burndown chart
        %p
          View your milestone's progress as a burndown chart.  Add both a start and a due date to
          this milestone and the chart will appear here, always up-to-date.

        = render Pajamas::ButtonComponent.new(href: edit_milestone_path(milestone)) do
          = _('Add start and due date')

= render 'shared/promotions/promote_burndown_charts', milestone: milestone
